<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core">

    <ui:composition template="/admintemplate.xhtml">
        <ui:define name="title">
            <h:outputText value="#{bundle.ListStaffTitle}"></h:outputText>
        </ui:define>
        <ui:define name="leftmenu">
            <h:form>
                <ul class="section menu">
                    <li><a class="menuitem">#{bundle.ControlPanelMenu}</a>
                        <ul class="submenu">
                            <li><h:commandLink action="#{staffController.prepareCreate}" value="#{bundle.ListStaffCreateLink}"/> </li>
                            <li><h:commandLink action="#{staffController.prepareList}" value="#{bundle.CreateStaffShowAllLink}" immediate="true"/> </li>
                        </ul>
                    </li>
                </ul>
            </h:form>
        </ui:define>
        <ui:define name="content">
            <h2>#{bundle.ListClassesTitle}</h2>
            <div class="block">
                <h:form>
                    <h:panelGroup id="messagePanel" layout="block">
                        <h:messages errorStyle="color: red" infoStyle="color: green" layout="list"/>
                    </h:panelGroup>
                    <h:outputText escape="false" value="#{bundle.ListStaffEmpty}" rendered="#{staffController.items.rowCount == 0}"/>
                    <h:panelGroup rendered="#{staffController.items.rowCount > 0}">
                        <div class="tablePaging">
                            <h:outputText value="Showing #{staffController.pagination.pageFirstItem + 1} to #{staffController.pagination.pageLastItem + 1} of #{staffController.pagination.itemsCount} entries"/>&nbsp;
                            <h:commandLink action="#{staffController.previous}" class="btn-icon btn-teal btn-arrow-left btn-small" rendered="#{staffController.pagination.hasPreviousPage}">
                                <span></span>
                                #{bundle.Previous} #{staffController.pagination.pageSize}
                            </h:commandLink>&nbsp;
                            <h:commandLink action="#{staffController.next}" class="btn-icon btn-teal btn-arrow-right btn-small" rendered="#{staffController.pagination.hasNextPage}">
                                <span></span>
                                #{bundle.Next} #{staffController.pagination.pageSize}
                            </h:commandLink>&nbsp;
                        </div>
                        <h:dataTable value="#{staffController.items}" class="CSSTableGenerator" var="item" border="0" cellpadding="2" cellspacing="0" rules="all">
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListStaffTitle_staffId}"/>
                                </f:facet>
                                <h:outputText value="#{item.staffId}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListStaffTitle_type}"/>
                                </f:facet>
                                <h:outputText value="#{staffController.getTypeStr(item.type)}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListStaffTitle_userName}"/>
                                </f:facet>
                                <h:outputText value="#{item.userName}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListStaffTitle_password}"/>
                                </f:facet>
                                <h:outputText value="#{item.password}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListStaffTitle_fullName}"/>
                                </f:facet>
                                <h:outputText value="#{item.fullName}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListStaffTitle_address}"/>
                                </f:facet>
                                <h:outputText value="#{item.address}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListStaffTitle_dateOfBirth}"/>
                                </f:facet>
                                <h:outputText value="#{item.dateOfBirth}">
                                    <f:convertDateTime pattern="MM/dd/yyyy" />
                                </h:outputText>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListStaffTitle_gender}"/>
                                </f:facet>
                                <h:outputText value="#{staffController.getGenderStr(item.gender)}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListStaffTitle_email}"/>
                                </f:facet>
                                <h:outputText value="#{item.email}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="#{bundle.ListStaffTitle_phone}"/>
                                </f:facet>
                                <h:outputText value="#{item.phone}"/>
                            </h:column>
                            <h:column>
                                <f:facet name="header">
                                    <h:outputText value="&nbsp;"/>
                                </f:facet>
                                <h:commandLink action="#{staffController.prepareView}" value="#{bundle.ListStaffViewLink}"/>
                                <h:outputText value=" "/>
                                <h:commandLink action="#{staffController.prepareEdit}" value="#{bundle.ListStaffEditLink}"/>
                                <h:outputText value=" "/>
                                <h:commandLink action="#{staffController.destroy}" value="#{bundle.ListStaffDestroyLink}"/>
                            </h:column>
                        </h:dataTable>
                    </h:panelGroup>
                </h:form>
            </div>
        </ui:define>
    </ui:composition>

</html>
